package homework.day10;



public class StringTest_3 {

	public static void main(String[] args) {

		String s1 = "adbccadebbcaaaaaa";
		String s2 = "edabccadeceaaaaaa";

		String s = getMaxSubstring(s2, s1);
		System.out.println("s=" + s);
	}


	public static String getMaxSubstring(String s1, String s2) {
		

		
		
		
		for (int i = 0; i < s2.length(); i++) {
			
			for(int a = 0,b = s2.length()-i; b != s2.length()+1; a++,b++){
				
				String sub = s2.substring(a, b);
//				System.out.println(sub);
				if(s1.contains(sub))
					return sub;
			}
		}
		
		return null;
	}
}
